package Listeners;

import gui.PanelGraphe;
import gui.PanelPrompt;

import java.awt.Component;
import java.awt.Container;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JPanel;
import javax.swing.JScrollBar;

public class VitesseMouseListener implements MouseListener {


	private PanelGraphe graphe;
	private JScrollBar vitesse;

	
	
	public VitesseMouseListener (JPanel parent, JScrollBar vitesse)
	{
		JPanel grandParent = (JPanel) parent.getParent();
		graphe = (PanelGraphe) grandParent.getComponent(0);
		this.vitesse = vitesse;
	}
	
	public void mouseClicked(MouseEvent e) {
		
	}

	public void mouseEntered(MouseEvent e) {
		
	}

	public void mouseExited(MouseEvent e) {
		
	}

	public void mousePressed(MouseEvent e) {
		graphe.setVitesse(vitesse.getValue());
	}

	public void mouseReleased(MouseEvent e) {
		graphe.setVitesse(vitesse.getValue());
		graphe.getPrompt().appendPrompt("*** Vitesse = "+vitesse.getValue()*100/vitesse.getMaximum()+" %***");

	}

}
